<?php
class Top {
	function viewAll() {
		$query = "select * from dt_top";
		$data = mysql_query($query);
		return $data;
	}
	
	function selectSingle($id) {
		$query = "select * from dt_top where top_id = '$id'";
		$data = mysql_query($query);
		return $data;
	}
	
	function insert($title, $content, $picture, $visible, $meta_title, $meta_desc, $meta_keys, $t_id) {
		mysql_query("insert into dt_top (`top_title`, `top_content`, `top_picture`, `top_visible`, `meta_title`, `meta_description`, `meta_keys`, `t_id`) values ('$title', '$content', $picture', '$visible', '$meta_title', '$meta_desc', '$meta_keys', '$t_id')");
	}
	
	function update($id, $title, $content, $picture, $visible, $t_id) {
		mysql_query("update dt_top set top_title = '$title', top_content = '$content', top_picture = '$picture', top_visible = '$visible', t_id = '$t_id' where top_id = '$id'");
	}
	
	function delete($id) {
		mysql_query("delete from dt_top where top_id = '$id'");
	}
	
	function updateNOPic($id, $title, $content, $visible, $t_id) {
		mysql_query("update dt_top set top_title = '$title', top_content = '$content', top_visible = '$visible', t_id = '$t_id' where top_id = '$id'");
	}
}
?>